package com.cv.platform.job;

import com.cv.platform.service.search.CvVideoSearchService;
import com.cv.platform.service.uv.CvDailyUvService;
import com.cv.platform.service.uv.CvVideoTypeUvService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 日常任务调度 - 每天凌晨 3 点
 *
 * @author Charles_XDXD
 */
@Slf4j
@Component
public class DailyJob {

    @Resource
    private CvDailyUvService cvDailyUvService;

    @Resource
    private CvVideoTypeUvService cvVideoTypeUvService;

    @Resource
    private CvVideoSearchService cvVideoSearchService;

    @XxlJob("dailyUvUpdateJob")
    public void dailyUvUpdateJob() {
        log.info("[DailyJob] 开始同步每日数据至数据库");
        cvDailyUvService.syncDailyUv();
        cvVideoTypeUvService.syncDailyUv();
        cvVideoSearchService.syncSearchRecord();
        log.info("[DailyJob] 每日数据同步更新完毕");
    }

}
